ProcessAttributeSetting = function (editor) {
    this.editor = editor;
    this.setting = this.getCurrentAttributeSetting("process");
};

mxUtils.extend(ProcessAttributeSetting, AttributeSetting);

ProcessAttributeSetting.prototype.render = function () {
    this.renderBasicAttr();
    this.renderForm();
    //this.renderExtra();
    //this.renderEvents();
    this.renderCallbacks();
    this.renderMessageNotifySetting();
    // 初始化listBox
    this.renderListBox();
};


ProcessAttributeSetting.prototype.update = function () {
    var displayName = $("#displayName").val().trim();
    var name = $("#name").val().trim();
    var form = $("#form").val().trim();
    this.setting.setAttribute('Name', ecapseNull(name));
    this.setting.setAttribute('Form', ecapseNull(form));
    this.setting.setAttribute('DisplayName', ecapseNull(displayName));
    var processClass = $('#processClass').val();
    this.setting.setAttribute('ProcessClass', processClass);
    this.setting.setAttribute('Description', ecapseNull($("#description").val().trim()));
    this.setting.setAttribute('Author', ecapseNull($("#author").val().trim()));
    this.setting.setAttribute('Category', $("#parentid").val());

    var FormConfiguration = DomHelper.createElement('FormConfiguration');
    var approveFormUrl = $("#approveFormUrl").val();
    var approveFormUrlParameters = $("#approveFormUrlParameters").val();
    var viewFormUrl = $("#viewFormUrl").val();
    var viewFormUrlParameters = $("#viewFormUrlParameters").val();
    var updateFormUrl = $("#updateFormUrl").val();
    var updateFormUrlParameters = $("#updateFormUrlParameters").val();
    FormConfiguration.setAttribute('approveFormUrl', approveFormUrl);
    FormConfiguration.setAttribute('approveFormUrlParameters', approveFormUrlParameters);
    FormConfiguration.setAttribute('viewFormUrl', viewFormUrl);
    FormConfiguration.setAttribute('viewFormUrlParameters', viewFormUrlParameters);
    FormConfiguration.setAttribute('updateFormUrl', updateFormUrl);
    FormConfiguration.setAttribute('updateFormUrlParameters', updateFormUrlParameters);
    var isIntegrateApproveHistoryValue = $("input[name='isIntegrateApproveHistory']:checked").val();
    FormConfiguration.setAttribute('isIntegrateApproveHistory', isIntegrateApproveHistoryValue);
    if (isIntegrateApproveHistoryValue == "true") {
        var approveHistoryFormSourceTypeValue = $("input[name='approveHistoryFormSourceType']:checked").val();
        FormConfiguration.setAttribute('approveHistoryFormSourceType', approveHistoryFormSourceTypeValue);
        if (approveHistoryFormSourceTypeValue == "false") {
            var approveHistoryFormUrl = $('#approveHistoryFormUrl').val();
            FormConfiguration.setAttribute('approveHistoryFormUrl', approveHistoryFormUrl);
        }
    }
    var integrateFormTypeProcess = $("input[name='integrateFormTypeProcess']:checked").val();
    FormConfiguration.setAttribute('integrateFormType', integrateFormTypeProcess);
    var integrateActivities = $('#inqu_status-0-nodeCodeProcess').val();
    FormConfiguration.setAttribute('integrateActivities', integrateActivities);
    var integrateActivitiestextField = $('#inqu_status-0-nodeCodeProcess_textField').val();
    FormConfiguration.setAttribute('integrateActivitiestextField', integrateActivitiestextField);


    //this.updateExtra();
    //this.updateEvents();
    this.updateCallbacks();

    var messageNotifySettingInputs = $('#messageNotifySettingInputs');
    var pmnEnable = $("input[name='pmnEnable']:checked").val();
    var amnEnable = $("input[name='amnEnable']:checked").val();
    var messageNotifySetting = DomHelper.createElement('MessageNotifySetting');
    messageNotifySetting.setAttribute('pmnEnable', pmnEnable);
    messageNotifySetting.setAttribute('amnEnable', amnEnable);

    var processEmailNotify = $('[name=processEmailNotify]').is(':checked');
    var processSmsNotify = $('[name=processSmsNotify]').is(':checked');
    var processWeChatNotify = $('[name=processWeChatNotify]').is(':checked');
    var processMobileNotify = $('[name=processMobileNotify]').is(':checked');
    var processImNotify = $('[name=processImNotify]').is(':checked');
    var processOCSNotify = $('[name=processOCSNotify]').is(':checked');
    if (processEmailNotify)
        messageNotifySetting.setAttribute('processEmailNotify', 'true');
    else
        messageNotifySetting.setAttribute('processEmailNotify', 'false');

    if (processSmsNotify)
        messageNotifySetting.setAttribute('processSmsNotify', 'true');
    else
        messageNotifySetting.setAttribute('processSmsNotify', 'false');

    if (processWeChatNotify)
        messageNotifySetting.setAttribute('processWeChatNotify', 'true');
    else
        messageNotifySetting.setAttribute('processWeChatNotify', 'false');

    if (processMobileNotify)
        messageNotifySetting.setAttribute('processMobileNotify', 'true');
    else
        messageNotifySetting.setAttribute('processMobileNotify', 'false');

    if (processImNotify)
        messageNotifySetting.setAttribute('processImNotify', 'true');
    else
        messageNotifySetting.setAttribute('processImNotify', 'false');

    if (processOCSNotify)
        messageNotifySetting.setAttribute('processOCSNotify', 'true');
    else
        messageNotifySetting.setAttribute('processOCSNotify', 'false');

    var activityAssignEmailNotify = $('[name=activityAssignEmailNotify]').is(':checked');
    var activityAssignSmsNotify = $('[name=activityAssignSmsNotify]').is(':checked');
    var activityAssignWeChatNotify = $('[name=activityAssignWeChatNotify]').is(':checked');
    var activityAssignMobileNotify = $('[name=activityAssignMobileNotify]').is(':checked');
    var activityAssignImNotify = $('[name=activityAssignImNotify]').is(':checked');
    var activityAssignOCSNotify = $('[name=activityAssignOCSNotify]').is(':checked');

    if (activityAssignEmailNotify)
        messageNotifySetting.setAttribute('activityAssignEmailNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityAssignEmailNotify', 'false');

    if (activityAssignSmsNotify)
        messageNotifySetting.setAttribute('activityAssignSmsNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityAssignSmsNotify', 'false');

    if (activityAssignWeChatNotify)
        messageNotifySetting.setAttribute('activityAssignWeChatNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityAssignWeChatNotify', 'false');

    if (activityAssignMobileNotify)
        messageNotifySetting.setAttribute('activityAssignMobileNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityAssignMobileNotify', 'false');

    if (activityAssignImNotify)
        messageNotifySetting.setAttribute('activityAssignImNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityAssignImNotify', 'false');

    if (activityAssignOCSNotify)
        messageNotifySetting.setAttribute('activityAssignOCSNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityAssignOCSNotify', 'false');

    var activityEndEmailNotify = $('[name=activityEndEmailNotify]').is(':checked');
    var activityEndSmsNotify = $('[name=activityEndSmsNotify]').is(':checked');
    var activityEndWeChatNotify = $('[name=activityEndWeChatNotify]').is(':checked');
    var activityEndMobileNotify = $('[name=activityEndMobileNotify]').is(':checked');
    var activityEndImNotify = $('[name=activityEndImNotify]').is(':checked');
    var activityEndOCSNotify = $('[name=activityEndOCSNotify]').is(':checked');

    if (activityEndEmailNotify)
        messageNotifySetting.setAttribute('activityEndEmailNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityEndEmailNotify', 'false');

    if (activityEndSmsNotify)
        messageNotifySetting.setAttribute('activityEndSmsNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityEndSmsNotify', 'false');

    if (activityEndWeChatNotify)
        messageNotifySetting.setAttribute('activityEndWeChatNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityEndWeChatNotify', 'false');

    if (activityEndMobileNotify)
        messageNotifySetting.setAttribute('activityEndMobileNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityEndMobileNotify', 'false');

    if (activityEndImNotify)
        messageNotifySetting.setAttribute('activityEndImNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityEndImNotify', 'false');

    if (activityEndOCSNotify)
        messageNotifySetting.setAttribute('activityEndOCSNotify', 'true');
    else
        messageNotifySetting.setAttribute('activityEndOCSNotify', 'false');

    var form = DomHelper.createElement('Form');
    var formValue = $('#form').val().trim();
    form.setAttribute('Value', formValue);
    var extra = DomHelper.getChild(this.setting, 'Extras');
    if (extra == null)
        if (FormConfiguration == null)
            return;
        else {
            extra = DomHelper.createElement('Extras');
            this.setting.appendChild(extra);
        }

    function updateNode(parent, childName, node) {
        var oldChild = DomHelper.getChild(parent, childName);
        if (node == null && oldChild != null)
            parent.removeChild(oldChild);
        else if (node != null && oldChild == null)
            parent.appendChild(node);
        else if (node != null && oldChild != null) {
            parent.replaceChild(node, oldChild);
        }
    }

    updateNode(extra, 'FormConfiguration', FormConfiguration);
    updateNode(extra, 'MessageNotifySetting', messageNotifySetting);
    updateNode(extra, 'Form', form);
    if (!DomHelper.hasChildElement(extra))
        this.setting.removeChild(extra);
};

/**
 * 渲染的基本属性设置页面
 */
ProcessAttributeSetting.prototype.renderBasicAttr = function () {
    $("#name").val(this.setting.getAttribute('Name'));
    $("#displayName").val(this.setting.getAttribute('DisplayName'));
    var processClass = this.setting.getAttribute('ProcessClass');
    processClass = (processClass == null || processClass == 'null') ? "A" : processClass;
    $('#processClassHide').val(processClass);
    $("#description").val(this.setting.getAttribute('Description'));
    var author = this.setting.getAttribute('Author');
    $("#author").val(author != "null" ? author : 'admin');
    getCatName(this.setting.getAttribute('Category'));
    $("#parentid").val(this.setting.getAttribute('Category'));
    $("#form").val(this.setting.getAttribute('Form'));
    $("#version").val(this.setting.getAttribute('Version'));
    //$("#deployTime").val(this.setting.getAttribute('DeployTime'));
    var date = new Date(this.setting.getAttribute('DeployTime'));
    var deployTime = formatDateTime(date);
    $("#deployTime").val(deployTime);
};

var formatDateTime = function (date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    var minute = date.getMinutes();
    minute = minute < 10 ? ('0' + minute) : minute;
    var second = date.getSeconds();
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
};

function getCatName(id) {
    var info = new EiInfo();
    var categoryName = "";
    info.set('id', id);
    EiCommunicator.send('EWPE00', 'getCategoryName', info, {
        onSuccess: function (outInfo) {
            categoryName = outInfo.get("categoryName");
            $("#basic-0-parentname").val(categoryName);
        },
        onFail: function (message) {
            alert(message);
        }
    }, false, false);
}

function ecapseNull(value) {
    return value == 'null' ? 'NULL' : value;
}

ProcessAttributeSetting.prototype.renderForm = function () {
    var dom = $(this.setting);
    var taskTacticsRegion = $('#FormConfiguration');
    var Values = $('input', taskTacticsRegion);
    var FormConfiguration = $(dom).find('FormConfiguration')[0];
    if (FormConfiguration != null && FormConfiguration != undefined) {
        $("#approveFormUrl").val(FormConfiguration.getAttribute('approveFormUrl'));
        $("#approveFormUrlParameters").val(FormConfiguration.getAttribute('approveFormUrlParameters'));
        $("#viewFormUrl").val(FormConfiguration.getAttribute('viewFormUrl'));
        $("#viewFormUrlParameters").val(FormConfiguration.getAttribute('viewFormUrlParameters'));
        $("#updateFormUrl").val(FormConfiguration.getAttribute('updateFormUrl'));
        $("#updateFormUrlParameters").val(FormConfiguration.getAttribute('updateFormUrlParameters'));
        taskTacticsRegion = $('#integrateApproveHistory');
        Values = $('input', taskTacticsRegion);
        var Value = FormConfiguration.getAttribute('isIntegrateApproveHistory');
        if (Value == "false") {
            $("#setApproveHistoryFormSourceType").hide();
        } else {
            $("#setApproveHistoryFormSourceType").show();
        }
        Values.each(function () {
            if ($(this).attr("Value") == Value) {
                $(this).attr("checked", true);
            }
        });
        taskTacticsRegion = $('#setApproveHistoryFormSourceType');
        Values = $('input', taskTacticsRegion);
        Value = FormConfiguration.getAttribute('approveHistoryFormSourceType');
        if (Value == "false") {
            $("#setApproveHistoryFormUrl").show();
        } else {
            $("#setApproveHistoryFormUrl").hide();
        }
        Values.each(function () {
            if ($(this).attr("Value") == Value) {
                $(this).attr("checked", true);
            }
        });
        $("#approveHistoryFormUrl").val(FormConfiguration.getAttribute('approveHistoryFormUrl'));

        Values = $("input[name='integrateFormTypeProcess']");
        Value = FormConfiguration.getAttribute('integrateFormType');
        Values.each(function () {
            if ($(this).attr("Value") == Value)
                $(this).attr("checked", "checked");
        });
        $('#inqu_status-0-nodeCodeProcess').val(FormConfiguration.getAttribute('integrateActivities'));
        $('#inqu_status-0-nodeCodeProcess_textField').val(FormConfiguration.getAttribute('integrateActivitiestextField'));
    } else {
        $("#setApproveHistoryFormSourceType").hide();
    }
};

/**
 * 渲染扩展属性数据表格
 *
 * @return
 */
ProcessAttributeSetting.prototype.renderExtra = function () {
    var dom = $(this.setting);
    var block = new Array();
    var grid = $("#ef_grid_extraResult").data("kendoGrid");

    function extraResult(Name, Type, Value, Desc) {
        this.Name = Name;
        this.Type = Type;
        this.Value = Value;
        this.Desc = Desc;
    }

    // 加载扩展属性数据
    $(dom).find('Variable').each(function () {
        var row = new extraResult();
        $.each(this.attributes, function (i, attrib) {
            var name = attrib.name;
            var value = attrib.value;
            row[this.name] = this.value;

        });
        block.push(row);
    });
    grid.dataSource.data(block);
};

/**
 * 保存扩展属性设置
 *
 * @return
 */
ProcessAttributeSetting.prototype.updateExtra = function () {
    var GRIDNAME = "extraResult";
    // 设置扩展属性
    var doc = this.createXmlDocument();
    var actExtraParams = $(this.setting).find('ActivityExtraParameters')[0];
    if (actExtraParams == null) {
        actExtraParams = doc.createElement('ActivityExtraParameters');
        $(this.setting).find('Extras')[0].appendChild(actExtraParams);
    } else
        $(actExtraParams).empty();

    var block = extraResultGrid.getBlockData();
    var variable = null;
    if (block.getRows().length > 0)
        for (var i = 0; i < block.getRows().length; i++) {
            variable = doc.createElement('Variable');
            variable.setAttribute('Name', block.getCell(i, 'Name'));
            variable.setAttribute('Type', block.getCell(i, 'Type'));
            variable.setAttribute('Value', block.getCell(i, 'Value'));
            variable.setAttribute('Desc', block.getCell(i, 'Desc'));
            actExtraParams.appendChild(variable);
        }
};

/**
 * 渲染事件配置数据表格
 * @return
 */
ProcessAttributeSetting.prototype.renderEvents = function () {

    var dom = $(this.setting);
    var block = new Array();
    var grid = $("#ef_grid_eventsResult").data("kendoGrid");

    function eventsResult(Type, Class, Description) {
        this.Type = Type;
        this.Class = Class;
        this.Description = Description;
    }

    // 加载扩展属性数据
    $(dom).find('Event').each(function () {
        var row = new eventsResult();
        row.Type = this.getAttribute("Type");
        row.Class = $(this).find('EventListener')[0].getAttribute("class");
        row.Description = $(this).find('EventListener')[0].getAttribute("Description");
        block.push(row);
    });
    grid.dataSource.data(block);
};

/**
 * 渲染回调配置数据表格
 * @return
 */
ProcessAttributeSetting.prototype.renderCallbacks = function () {

    var dom = $(this.setting);
    var block = new Array();
    var grid = $("#ef_grid_callbacksResult").data("kendoGrid");

    function eventsResult(Type, ServiceId, Description,SyncType) {
        this.Type = Type;
        this.SyncType = SyncType;
        this.ServiceId = ServiceId;
        this.Description = Description;
    }

    // 加载扩展属性数据
    $(dom).find('Callback').each(function () {
        var row = new eventsResult();
        row.Type = this.getAttribute("Type");
        row.SyncType = this.getAttribute("SyncType");
        row.ServiceId = this.getAttribute("ServiceId");
        row.Description = this.getAttribute("Description");
        block.push(row);
    });
    grid.dataSource.data(block);
};

/**
 * 保存事件配置
 *
 * @return
 */
ProcessAttributeSetting.prototype.updateEvents = function () {
    var doc = this.createXmlDocument();
    var events = $(this.setting).find('Events')[0];
    if (events == null) {
        events = doc.createElement('Events');
        $(this.setting).find('Extras')[0].appendChild(events);
    } else
        $(events).empty();
    var grid = $("#ef_grid_eventsResult").data("kendoGrid");
    var block = grid.getBlockData();

    if (block.getRows().length > 0)
        for (var i = 0; i < block.getRows().length; i++) {
            var event = doc.createElement('Event');
            event.setAttribute('Type', block.getCell(i, 'Type'));
            var evtListener = doc.createElement('EventListener');
            evtListener.setAttribute('class', block.getCell(i, 'Class'));
            evtListener.setAttribute('Description', block.getCell(i,
                'Description'));
            event.appendChild(evtListener);
            events.appendChild(event);
        }
};

/**
 * 保存回调配置
 *
 * @return
 */
ProcessAttributeSetting.prototype.updateCallbacks = function () {
    var doc = this.createXmlDocument();
    var callbacks = $(this.setting).find('Callbacks')[0];
    if (callbacks == null) {
        callbacks = doc.createElement('Callbacks');
        $(this.setting).find('Extras')[0].appendChild(callbacks);
    } else
        $(callbacks).empty();
    var grid = $("#ef_grid_callbacksResult").data("kendoGrid");
    var block = grid.getBlockData();

    if (block.getRows().length > 0)
        for (var i = 0; i < block.getRows().length; i++) {
            var callback = doc.createElement('Callback');
            callback.setAttribute('Type', block.getCell(i, 'Type'));
            callback.setAttribute('SyncType', block.getCell(i, 'SyncType'));
            callback.setAttribute('ServiceId', block.getCell(i, 'ServiceId'));
            callback.setAttribute('Description', block.getCell(i, 'Description'));
            callbacks.appendChild(callback);
        }
};

/**
 * 渲染消息通知
 */
ProcessAttributeSetting.prototype.renderMessageNotifySetting = function () {
    var extra = DomHelper.getChild(this.setting, 'Extras');
    if (extra == null)
        return;

    var blk;
    var ei = _getEi();
    var vars = extra.getElementsByTagName('Variable');

    var mns = extra.getElementsByTagName('MessageNotifySetting');
    var messageNotifySettingInputs = $('#messageNotifySettingInputs');

    if (mns.length > 0) {

        mns = mns[0];
        var pmnEnable = mns.getAttribute('pmnEnable');
        var amnEnable = mns.getAttribute('amnEnable');

        var pmnEnables = $('input[name="pmnEnable"]', messageNotifySettingInputs);
        pmnEnables.each(function () {
            if ($(this).attr("value") == pmnEnable)
                $(this).attr("checked", "checked");
        });

        var amnEnables = $('input[name="amnEnable"]', messageNotifySettingInputs);
        amnEnables.each(function () {
            if ($(this).attr("value") == amnEnable)
                $(this).attr("checked", "checked");
        });

        var processEmailNotify = mns.getAttribute('processEmailNotify');
        var processSmsNotify = mns.getAttribute('processSmsNotify');
        var processWeChatNotify = mns.getAttribute('processWeChatNotify');
        var processMobileNotify = mns.getAttribute('processMobileNotify');
        var processImNotify = mns.getAttribute('processImNotify');
        var processOCSNotify = mns.getAttribute('processOCSNotify');

        if (processEmailNotify == 'true')
            $('[name=processEmailNotify]').attr("checked", "checked");

        if (processSmsNotify == 'true')
            $('[name=processSmsNotify]').attr("checked", "checked");

        if (processWeChatNotify == 'true')
            $('[name=processWeChatNotify]').attr("checked", "checked");

        if (processMobileNotify == 'true')
            $('[name=processMobileNotify]').attr("checked", "checked");

        if (processImNotify == 'true')
            $('[name=processImNotify]').attr("checked", "checked");

        if (processOCSNotify == 'true')
            $('[name=processOCSNotify]').attr("checked", "checked");

        var activityAssignEmailNotify = mns.getAttribute('activityAssignEmailNotify');
        var activityAssignSmsNotify = mns.getAttribute('activityAssignSmsNotify');
        var activityAssignWeChatNotify = mns.getAttribute('activityAssignWeChatNotify');
        var activityAssignMobileNotify = mns.getAttribute('activityAssignMobileNotify');
        var activityAssignImNotify = mns.getAttribute('activityAssignImNotify');
        var activityAssignOCSNotify = mns.getAttribute('activityAssignOCSNotify');

        if (activityAssignEmailNotify == 'true')
            $('[name=activityAssignEmailNotify]').attr("checked", "checked");

        if (activityAssignSmsNotify == 'true')
            $('[name=activityAssignSmsNotify]').attr("checked", "checked");

        if (activityAssignWeChatNotify == 'true')
            $('[name=activityAssignWeChatNotify]').attr("checked", "checked");

        if (activityAssignMobileNotify == 'true')
            $('[name=activityAssignMobileNotify]').attr("checked", "checked");

        if (activityAssignImNotify == 'true')
            $('[name=activityAssignImNotify]').attr("checked", "checked");

        if (activityAssignOCSNotify == 'true')
            $('[name=activityAssignOCSNotify]').attr("checked", "checked");

        var activityEndEmailNotify = mns.getAttribute('activityEndEmailNotify');
        var activityEndSmsNotify = mns.getAttribute('activityEndSmsNotify');
        var activityEndWeChatNotify = mns.getAttribute('activityEndWeChatNotify');
        var activityEndMobileNotify = mns.getAttribute('activityEndMobileNotify');
        var activityEndImNotify = mns.getAttribute('activityEndImNotify');
        var activityEndOCSNotify = mns.getAttribute('activityEndOCSNotify');

        if (activityEndEmailNotify == 'true')
            $('[name=activityEndEmailNotify]').attr("checked", "checked");

        if (activityEndSmsNotify == 'true')
            $('[name=activityEndSmsNotify]').attr("checked", "checked");

        if (activityEndWeChatNotify == 'true')
            $('[name=activityEndWeChatNotify]').attr("checked", "checked");

        if (activityEndMobileNotify == 'true')
            $('[name=activityEndMobileNotify]').attr("checked", "checked");

        if (activityEndImNotify == 'true')
            $('[name=activityEndImNotify]').attr("checked", "checked");

        if (activityEndOCSNotify == 'true')
            $('[name=activityEndOCSNotify]').attr("checked", "checked");
    }

    //为了兼容历史版本，保留这种表单设置方式
    var forms = extra.getElementsByTagName('Form');

    var formValue = this.setting.getAttribute('Form');

    if ((formValue == null || formValue == "") && forms.length > 0)
        formValue = forms[0].getAttribute('Value');

    $('#form').val(formValue);
}

ProcessAttributeSetting.prototype.renderListBox = function () {
    var activities = this.getAllActivities();
    var allData = [], dataA = [], dataB = [];

    var curActivityName = this.setting.getAttribute("Name");

    $(activities).each(function () {
        var row = {};
        row.Name = this.value.getAttribute("Name");
        row.DisplayName = this.value.getAttribute("Name")+"-"+this.value.getAttribute("DisplayName");

        allData.push(row);
    });

    var row = {};
    row.Name = "PROCESSDEF";
    row.DisplayName = "PROCESSDEF";
    allData.push(row);

    dataA = allData;

    var nodeCode = $("#inqu_status-0-nodeCodeProcess").val() || "";
    var nodeCode_textField = $("#inqu_status-0-nodeCodeProcess_textField").val() || "";

    if (_.isString(nodeCode)) {
        var list = nodeCode.split(","), selectItem;
        _.each(list, function (id) {
            if (selectItem = _.find(dataA, function (item) {
                    return item.Name === id;
                })) {
                dataA.splice(_.indexOf(dataA, selectItem), 1);
                dataB.push(selectItem);
            }
        })
    }

    $("#listBoxA").kendoListBox({
        connectWith: "listBoxB",
        draggable: true,
        dataSource: {
            data: dataA
        },
        dataTextField: "DisplayName",
        dataValueField: "Name",
        toolbar: {
            tools: [
                "transferTo",
                "transferFrom",
                "transferAllTo",
                "transferAllFrom"
            ]
        }
    });

    $("#listBoxB").kendoListBox({
        dataSource: {
            data: dataB
        },
        draggable: true,
        dataTextField: "DisplayName",
        dataValueField: "Name"
    });

};

ProcessAttributeSetting.prototype.getAllActivities = function () {
    var graph = this.editor.graph;
    var root = null;
    root = graph.getCurrentRoot();
    if (root == null) {
        root = graph.getModel().getRoot();
    }
    var model = graph.getModel();
    var filter = function (cell) {
        var tagName = cell.value.tagName;
        return model.isVertex(cell) && (tagName == 'Start' || tagName == 'Manual');
    }
    var acts = [];

    var rootChilds = model.getChildCells(model.getCell("1"));
    $(rootChilds).each(function () {
        var tagName = this.value.tagName;
        if (model.isVertex(this) && tagName == 'Swimlane') {
            var slChilds = model.filterCells(model.getChildCells(this), filter);
            $(slChilds).each(function () {
                acts.push(this);
            });
        }
        if (model.isVertex(this) && (tagName == 'Manual'))
            acts.push(this);
    });

    return acts;
};